<template>
  <div>
    <span  style="margin-left: 300px;">法人行：</span>
    <span>
      <el-select v-model="instId" placeholder="请选择">
          <el-option
            v-for="item in instInfo"
            :key="item"
            :label="item"
            :value="item">
          </el-option>
        </el-select>
    </span>
    <span style="margin-left: 200px;">批次日期：</span>
    <span>
      <el-date-picker
        v-model="selectDate"
        align="right"
        type="date"
        placeholder="选择日期"
        value-format="yyyyMMdd">
      </el-date-picker>
    </span>
    <div style="margin-top: 20px; height: ;">
      <span style="margin-left: 450px;">
        <el-button type="success" @click="getList">确认</el-button>
      </span>
      <span style="margin: 100px;">
        <el-button type="primary" @click="buttonReset">重置</el-button>
      </span>
    </div>
    <div style="margin-top: 50px; width: 100%;">
      <el-table
          :data="excpList"
          stripe
          style="width: 100%"
          max-height="400"
          v-if="excpList!=null">
          <el-table-column
            fixed
            prop="taskParam"
            :formatter="taskParamFormatter"
            label="任务参数"
            min-width="10%">
          </el-table-column>
          <el-table-column
            prop="batchDate"
            label="批次日期"
            min-width="10%">
          </el-table-column>
          <el-table-column
            prop="batchNo"
            label="批次号"
            min-width="10%">
          </el-table-column>
          <el-table-column
            prop="bizProdType"
            label="业务产品类型"
            min-width="10%"
            :formatter="bizProdTypeFormatter">
          </el-table-column>
          <el-table-column
            prop="atomTaskId"
            label="原子任务号"
            min-width="20%">
          </el-table-column>
          <el-table-column
            prop="taskDesc"
            label="任务描述"
            min-width="10%">
          </el-table-column>
          <el-table-column
            prop="excpCfrmType"
            label="异常确认类型"
            min-width="10%"
            :formatter="excpCfrmTypeFormatter">
          </el-table-column>
          <el-table-column
            prop="excpCfrmStatus"
            label="异常确认描述"
            min-width="10%"
            :formatter="excpCfrmStatusFormatter">
          </el-table-column>
          <el-table-column
            fixed="right"
            label="操作"
            min-width="10%">
            <template slot-scope="scope">
              <el-button v-if="scope.row.excpCfrmStatus == '1'" @click="handleClick(scope.row,'2')" type="text" size="small">通过</el-button>
              <el-button v-if="scope.row.excpCfrmStatus == '1'" @click="handleClick(scope.row,'3')" type="text" size="small">拒绝</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align: right;">
          <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage"
                :page-sizes="[10,15,20,50,100]"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
                v-if="excpList!=null">
              </el-pagination>
        </div>
      </div>
  </div>
</template>

<script>
  export default{
    data(){
      return{
        instInfo : null,
        instId : null,
        selectDate : null,
        excpList : null,
        currentPage: 1, // 当前页码
        total: null, // 总条数
        pageSize: 15 // 每页的数据条数
      }
    },
    methods:{
      buttonReset : function(){
        this.selectDate = null;
        this.instId = null;
        this.excpList = null;
      },
      excpCfrmStatusFormatter : function(row,column){
        if (row.excpCfrmStatus == "0") return '无需确认';
        if (row.excpCfrmStatus == "1") return '需要确认';
        if (row.excpCfrmStatus == "2") return '确认通过';
        if (row.excpCfrmStatus == "3") return '确认不通过';
      },
      excpCfrmTypeFormatter : function(row,column){
        if (row.excpCfrmType == "1") return '清分异常确认';
        if (row.excpCfrmType == "2") return '清算异常确认';
        if (row.excpCfrmType == "3") return '差错确认';
        if (row.excpCfrmType == "4") return '资金核对确认';
        if (row.excpCfrmType == "5") return 'D0补入账资金核对确认';
        if (row.excpCfrmType == "6") return '内部户入账失败确认';
        if (row.excpCfrmType == "7") return '组合支付D0补入账资金核对确认';
      },
      bizProdTypeFormatter : function(row,column){
        if (row.bizProdType == "01") return '银联CUPS受理侧';
                                if (row.bizProdType == "02") return '微信支付';
                                if (row.bizProdType == "03") return '支付宝支付';
                                if (row.bizProdType == "04") return '分期';
                                if (row.bizProdType == "05") return '积分';
                                if (row.bizProdType == "06") return '银联小微二维码';
                                if (row.bizProdType == "07") return '网联受理侧';
                                if (row.bizProdType == "08") return '本行渠道业务';
                                if (row.bizProdType == "11") return '银联助农业务';
                                if (row.bizProdType == "21") return '银联线上支付';
                                if (row.bizProdType == "22") return '银联无卡快捷受理侧支付业务';
                                if (row.bizProdType == "32") return '银联无卡快捷代付业务';
                                if (row.bizProdType == "33") return '银联无卡快捷代收业务';
                                if (row.bizProdType == "23") return '银联全渠道_代付业务';
                                if (row.bizProdType == "24") return '银联全渠道_无跳转业务';
                                if (row.bizProdType == "25") return '银联全渠道_代收业务';
                                if (row.bizProdType == "26") return '深圳银联业务';
                                if (row.bizProdType == "27") return '厦门银联业务';
                                if (row.bizProdType == "31") return '银联二维码';
                                if (row.bizProdType == "34") return '银联网关支付';
                                if (row.bizProdType == "40") return '提现';
                                if (row.bizProdType == "45") return '营销';
                                if (row.bizProdType == "90") return '银联CUPS发卡侧';
                                if (row.bizProdType == "91") return '网联发卡侧';
                                if (row.bizProdType == "92") return '银联无卡快捷发卡侧';
                                if (row.bizProdType == "41") return '商户入账失败挂账';
                                if (row.bizProdType == "42") return '风险资金挂账';
                                if (row.bizProdType == "43") return '商户风险资金入账失败挂账';
                                if (row.bizProdType == "46") return 'D0补入账';
                                if (row.bizProdType == "47") return '虚拟账户业务';
                                if (row.bizProdType == "48") return '人行大小额';
                                if (row.bizProdType == "49") return '超级网银';
                                if (row.bizProdType == "44") return '代理商分润';
                                if (row.bizProdType == "50") return '中金支付';
                                if (row.bizProdType == "51") return 'D1垫资资金回填';
                                if (row.bizProdType == "52") return '连锁商户入账';
                                if (row.bizProdType == "53") return '内部户记账';
                                if (row.bizProdType == "60") return '本行渠道D0业务';
                                if (row.bizProdType == "61") return '银联CUPS受理侧D0业务';
                                if (row.bizProdType == "62") return '微信支付D0业务';
                                if (row.bizProdType == "63") return '支付宝支付D0业务';
                                if (row.bizProdType == "64") return '银联无卡快捷受理侧支付D0业务';
                                if (row.bizProdType == "65") return '银联全渠道_无跳转D0业务';
                                if (row.bizProdType == "66") return '银联网关支付D0业务';
                                if (row.bizProdType == "67") return '银联二维码D0业务';
                                if (row.bizProdType == "*")  return '所有业务';
                                return "";
      },
      taskParamFormatter : function(row,column){
          if(!row.hasOwnProperty("taskParam")){
            return "--"
          }
      },
      getInstInfo : function(){
        this.$get(`/admin/batchExcpCfrm/instList`).then((r) => {
          this.instInfo = new Array();
          for(let index=0; index<r.data.instInfoList.length; index++){
            this.instInfo[index] = r.data.instInfoList[index].instId+"-"+r.data.instInfoList[index].instName;
          }
        })
      },
      getList : function(){
        this.$get(`/admin/batchExcpCfrm/list`,{
          instId : this.instId,
          batchDate : this.selectDate,
          currentPage : this.currentPage,
          pageSize : this.pageSize,
        }).then((r) => {
          console.log(r);
          this.excpList = r.data.rows;
          this.total = r.data.total;
        })
      },
      handleClick : function(row,status){
        this.$post(`/admin/batchExcpCfrm/edit`,{
          excpCfrmStatus : status,
          instId : row.instId,
          batchDate : row.batchDate,
          batchNo : row.batchNo,
          bizProdType : row.bizProdType,
          excpCfrmType : row.excpCfrmType,
        }).then((r) => {
          this.$alert(r.data.message, ' ', {
          })
          this.getList();
        })
      },
      handleSizeChange(val) {
        this.pageSize = val;
        this.getList();
      },
                      //当前页改变时触发 跳转其他页
      handleCurrentChange(val) {
        this.currentPage = val;
        this.getList();
      },
    },
    mounted: function () {
      this.getInstInfo()
    },
  }

</script>

<style>

</style>
